const path = require('path');
const fs = require('fs');
const { name, version } = require('../package.json');

if (fs.existsSync(path.resolve('./_map'))) {
  fs.rmSync(path.resolve('./_map'), { recursive: true });
}

fs.mkdirSync(path.resolve('./_map'));
fs.renameSync(
  path.resolve('./dist/umi.js.map'),
  path.resolve(`./_map/${name.replace(/^@ydc\//, '')}.${version}.js.map`),
);
